package com.core.image.core.box;

import com.core.image.core.SendPacket;

import java.io.File;
import java.io.FileInputStream;

/**
 * describe:
 *
 * @author 库琦
 * @date 2020/01/29
 */
public class FileSendPacket extends SendPacket<FileInputStream> {
    private final File file;
    public FileSendPacket(File file){
        this.length = file.length();
        this.file = file;
    }
    @Override
    public FileInputStream createStream() {
        try {
            return new FileInputStream(file);
        }catch (Exception e){
            e.printStackTrace();
        }
            return null;
    }

    @Override
    public byte type() {
        return TYPE_STREAM_FILE;
    }
}
